using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WPCoco;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using WPCoco.Graphics;
using WPCoco.Tasks;

namespace TextureNodeDemo.Scenes
{
    public class MainScene : Scene
    {
        public MainScene()
        {
            // Create an sprite and position it in the screen
            Sprite spr0 = new Sprite(Coco.Load<Texture2D>("Amazing"));
            spr0.Anchor = new Vector2(0, 0.5f);
            spr0.Position = new Vector2(100, Screen.Height * 0.5f);

            // Create one TextureNode or any derived class (SimpleWaveNode this time) as parent of the LocalizedNode,
            // the grid size of the number of cell that is divided the mesh, for lower sizes will see an sloppy animation
            SimpleWaveNode host = new SimpleWaveNode(spr0, new Size(120, 20))
            {
                // Setting wave properties
                WaveSpeed = 15,
                WaveLength = 40,
                WaveRadius = 500,
                WaveFactor = 0.05f,
                WaveCenter = new Vector2(0, spr0.Height * 0.5f)
            };


            // Adding the Texture node host instead of the sprite
            AddNode(host);

            // Adding 3 "Exclamation" sprites
            for (int i = 1; i <= 3; i++)
            {
                Sprite spr1 = new Sprite(Coco.Load<Texture2D>("Exclamation"));
                spr1.Position = spr0.Position + new Vector2(25 * i + 480, -15);
                spr1.RunTask(new Sequence(
                                new Hide(),
                                new Transparent(),
                                new FiniteTime(0.5f * i),
                                new Show(),
                                new Spawn(
                                    new FadeIn(0.3f),
                                    new EaseExponentialOut(
                                        new MoveBy(new Vector2(0, 15), 0.8f)))));
                AddNode(spr1);
            }
        }
    }
}
